package cn.com.interstore.bg.dom.org;

import java.util.List;

import org.nakedobjects.applib.AbstractFactoryAndRepository;
import org.nakedobjects.applib.Filter;
import org.nakedobjects.applib.annotation.Exploration;
import org.nakedobjects.applib.annotation.MemberOrder;

public class OrganizationRepository extends AbstractFactoryAndRepository {
	// {{ Create new (still transient) Organization
	public Organization newOrganization() {
		Organization organization = newTransientInstance(Organization.class);
		// TODO: set up any properties

		return organization;
	}

	// }}

	// {{ all Organization
	@Exploration
	public List<Organization> allOrganization() {
		return allInstances(Organization.class);
	}

	// }}

	// {{ findByName
	@MemberOrder(sequence = "1")
	public List<Organization> findByName(final String name) {
		return this.allMatches(Organization.class, new Filter<Organization>() {
			public boolean accept(final Organization organization) {
				return organization.getName().equals(name);
			}
		});
		
	}
	// }}

}
